<?php
// 数据库操作
// 连接数据库
include "./common.php";
$username = $_GET['username'];
$gender = $_GET['gender'];
$age = $_GET['age'];

$sql = "INSERT INTO students (username,gender,age) VALUES ('$username','$gender',$age)";
// echo $sql;die;
$res =  mysqli_query($link,$sql);
if( mysqli_affected_rows($link)){  //查看sql是否有影响的行数；
	// echo "添加成功";	
	// echo "<script>alert('添加成功')</script>";
	// header("Location:index.php");  //php跳转
	echo "<script>alert('添加成功');window.location.href='index.php';</script>";
	
}else{
	echo "添加失败";
}



?>